package com.xdf.whiteaccount.enums;

/**
 * @author chanchaw
 * @create 2023-05-05 15:26
 */
public enum OpeEnum {
    NEW(0,"新增"),DELETE(1,"删除"),
    UPDATE(2,"修改"),QUERY(3,"查询"),
    ;
    private int index;
    private String desc;

    // 通过枚举值获取索引
    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    OpeEnum(int index, String desc) {
        this.index = index;
        this.desc = desc;
    }

    // 根据索引返回枚举值
    static OpeEnum of(int index){
        for(OpeEnum item:OpeEnum.values()){
            if(item.getIndex() == index) return item;
        }
        return null;
    }
}
